#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2021/10/18 22:18
# @File           : crud.py
# @IDE            : PyCharm
# @desc           : 数据库 增删改查操作

from motor.motor_asyncio import AsyncIOMotorDatabase
from . import schemas
from core.mongo_manage import MongoManage


class OperationRecordDal(MongoManage):

    def __init__(self, db: AsyncIOMotorDatabase):
        super(OperationRecordDal, self).__init__()
        self.db = db
        self.collection = db["operation_record"]
        self.schema = schemas.OperationRecordSimpleOut
        self.is_object_id = True


class ApiCallRecordDal(MongoManage):

    def __init__(self, db: AsyncIOMotorDatabase):
        super(ApiCallRecordDal, self).__init__()
        self.db = db
        self.collection = db["apicall_record"]
        self.schema = schemas.ApiCallRecordSimpleOut
        self.is_object_id = True
